import {
  TableColumn,
  TableColumns,
} from "naive-ui/es/data-table/src/interface";

export const computedScrollX = (columns: TableColumns) => {
  let scrollX = 0;
  columns.forEach((col: TableColumn) => {
    if (col.width) {
      if (typeof col.width === "string") {
        scrollX += Number.parseInt(col.width);
      } else {
        scrollX += col.width;
      }
    }
  });
  return scrollX;
};
